feat: add docker compose security scanning and multi-service orchestr…#98
Merged
advaitpatel merged 5 commits intoJun 12, 2026
Merged
Conversation
…ation ## Summary Adds native support for scanning `docker-compose.yml` files. This feature detects orchestration-level misconfigurations and automatically orchestrates the existing Dockerfile and image scans for every service defined in the compose file. ## Changes - **Compose Parser**: Added `ComposeScanner` using `ruamel.yaml` to parse compose files while preserving accurate line numbers for findings. - **Compose Orchestrator**: Added `ComposeOrchestrator` which extracts all services, identifies their build contexts/images, and runs the existing `DockerSecurityScanner` on each. - **Checks Implemented**: - **CRITICAL**: `compose-docker-socket-mount`, `compose-privileged`, `compose-host-network`, `compose-host-namespace`, `compose-dangerous-capabilities`, `compose-sensitive-host-mount` - **HIGH**: `compose-plaintext-secret-env`, `compose-port-bound-all-interfaces`, `compose-disabled-security-opt`, `compose-no-non-root-user` - **MEDIUM**: `compose-latest-or-untagged-image`, `compose-no-resource-limits`, `compose-env-file-secret-risk`, `compose-writable-root-fs` - **LOW**: `compose-no-new-privileges`, `compose-no-network-segmentation`, `compose-missing-healthcheck` - **Pipeline Integration**: All compose-level findings and per-service findings are merged and passed through the existing LLM remediation layer and scoring system. - **CLI**: Added the `--compose [PATH]` flag. If no path is provided, it auto-detects standard compose filenames in the current directory. - **Docs & Examples**: Updated `README.md`, added `docs/CHANGELOG.md` entries, and added insecure/secure compose examples in the `examples/compose/` directory. ## Testing - Added `tests/test_compose_scanner.py` with full coverage for parser logic, every rule, line mapping, integration, and offline mode. - Existing test suite passes unchanged.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds native support for scanning
docker-compose.ymlfiles. This feature detects orchestration-level misconfigurations and automatically orchestrates the existing Dockerfile and image scans for every service defined in the compose file.Changes
ComposeScannerusingruamel.yamlto parse compose files while preserving accurate line numbers for findings.ComposeOrchestratorwhich extracts all services, identifies their build contexts/images, and runs the existingDockerSecurityScanneron each.compose-docker-socket-mount,compose-privileged,compose-host-network,compose-host-namespace,compose-dangerous-capabilities,compose-sensitive-host-mountcompose-plaintext-secret-env,compose-port-bound-all-interfaces,compose-disabled-security-opt,compose-no-non-root-usercompose-latest-or-untagged-image,compose-no-resource-limits,compose-env-file-secret-risk,compose-writable-root-fscompose-no-new-privileges,compose-no-network-segmentation,compose-missing-healthcheck--compose [PATH]flag. If no path is provided, it auto-detects standard compose filenames in the current directory.README.md, addeddocs/CHANGELOG.mdentries, and added insecure/secure compose examples in theexamples/compose/directory.Testing
tests/test_compose_scanner.pywith full coverage for parser logic, every rule, line mapping, integration, and offline mode.